package mt.omid.dimomuth.statistics;


import java.util.concurrent.atomic.AtomicInteger;


public class Counter
{

    private String	name;
    //    private int    num;
    private AtomicInteger num;


    public Counter( String name )
    {
	this.name = name;
	this.num = new AtomicInteger( 0 );
    }

    public Counter( String name, int num )
    {
	this.name = name;
	//	this.num = num;
	this.num = new AtomicInteger( num );
    }

    /**
     * Copy Constructor
     * 
     * @return
     */

    public Counter clone()
    {
	return new Counter( this.name, this.num.get() );
    }

    public String getName()
    {
	return name;
    }

    public int getNum()
    {
	return num.get();
    }

    public void setNum( int num )
    {
	this.num.set( num );
    }

    public void stepUp()
    {
	this.num.incrementAndGet();
    }

    public void stepDown()
    {
	this.num.decrementAndGet();
    }

    public void reset()
    {
	this.num.set( 0 );
    }
}
